#include <iostream>
#include <algorithm>

int x, y;

int main()
{
	while (std::cin >> x >> y) {
		if (x > y) { std::cout << "-1\n"; continue; }
		if (x == 1) { std::cout << y-1 << '\n'; continue; }
		double sum = 1;
		int num = 1, count = 0;

		for (int cnt = 1; cnt < x; cnt++){
			int l = 0 , r = y , ans = -1;
			while (l <= r) {
				int mid = (l + r) >> 1;
				long long res = (sum+mid) / num * x;
				if (res <= y) { ans = mid; l = mid + 1; }
				else r = mid - 1;
			}
			if (ans > 0){ count += ans; sum = sum + ans; }
			count++;
			sum = (sum / num) * (num + 1);
			num++;
		}
		long long res = sum;
		if (res < y) count += y - res;
		std::cout << count << '\n';
	}
}

